
package com.thor.palmmall.dao.statement;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Index;

import com.thor.commons.entity.UCN;
import com.thor.commons.jpa.entity.PStandardEntity;

/**
 * @author:liyang
 * @time:2017年8月16日 上午11:08:43
 * @since:1.0
 */

@Entity
@Table(name = "PStatementPayBillDetail")
@org.hibernate.annotations.Table(appliesTo = "PStatementPayBillDetail", indexes = {
    @Index(name = "idx_PStatementPayBillDetail_1", columnNames = {
        "accId" }) })
public class PStatementPayBillDetail extends PStandardEntity {
  private static final long serialVersionUID = -3237081361629398432L;

  private PStatementPayBill statementBill;
  private UCN subject;
  private Date beginDate;
  private Date endDate;
  private BigDecimal payTotal;
  private BigDecimal payedTotal;
  private BigDecimal unpayedTotal;
  private String accId;
  private String bankCode;// 银行代码
  private BigDecimal poundage = BigDecimal.ZERO;// 手续费

  @ManyToOne(cascade = {
      CascadeType.ALL })
  @JoinColumn(name = "statementBillUuid", nullable = false)
  public PStatementPayBill getStatementBill() {
    return statementBill;
  }

  public void setStatementBill(PStatementPayBill statementBill) {
    this.statementBill = statementBill;
  }

  @Embedded
  @AttributeOverrides({
      @AttributeOverride(name = "uuid",
          column = @Column(name = "subjectUuid", length = 38, nullable = false) ),
      @AttributeOverride(name = "code",
          column = @Column(name = "subjectCode", length = 50, nullable = false) ),
      @AttributeOverride(name = "name", column = @Column(name = "subjectName", length = 100) ) })

  public UCN getSubject() {
    return subject;
  }

  public void setSubject(UCN subject) {
    this.subject = subject;
  }

  @Column(name = "beginDate", nullable = true)
  public Date getBeginDate() {
    return beginDate;
  }

  public void setBeginDate(Date beginDate) {
    this.beginDate = beginDate;
  }

  @Column(name = "endDate", nullable = true)
  public Date getEndDate() {
    return endDate;
  }

  public void setEndDate(Date endDate) {
    this.endDate = endDate;
  }

  @Column(name = "payTotal", nullable = false, scale = 2)
  public BigDecimal getPayTotal() {
    return payTotal;
  }

  public void setPayTotal(BigDecimal payTotal) {
    this.payTotal = payTotal;
  }

  @Column(name = "payedTotal", nullable = false, scale = 2)
  public BigDecimal getPayedTotal() {
    return payedTotal;
  }

  public void setPayedTotal(BigDecimal payedTotal) {
    this.payedTotal = payedTotal;
  }

  @Column(name = "unpayedTotal", nullable = false, scale = 2)
  public BigDecimal getUnpayedTotal() {
    return unpayedTotal;
  }

  public void setUnpayedTotal(BigDecimal unpayedTotal) {
    this.unpayedTotal = unpayedTotal;
  }

  @Column(name = "accId", nullable = false)
  public String getAccId() {
    return accId;
  }

  public void setAccId(String accId) {
    this.accId = accId;
  }

  /**
   * 获取支付账户
   * 
   * @return
   */
  @Column(name = "bankCode")
  public String getBankCode() {
    return bankCode;
  }

  public void setBankCode(String bankCode) {
    this.bankCode = bankCode;
  }

  /**
   * 获取手续费
   * 
   * @return
   */
  @Column(name = "poundage", nullable = false, scale = 2)
  public BigDecimal getPoundage() {
    return poundage;
  }

  public void setPoundage(BigDecimal poundage) {
    this.poundage = poundage;
  }

}
